package daiwei.javaWeb.exam.service;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.transaction.annotation.Transactional;

import daiwei.javaWeb.exam.meta.BoughtProduct;
import daiwei.javaWeb.exam.meta.Product;
import daiwei.javaWeb.exam.meta.Result;
import daiwei.javaWeb.exam.meta.ShowProduct;
import daiwei.javaWeb.exam.meta.User;

public interface DataBaseOP {
	
	public User getUser(String userName,String password) throws Exception;

	public List<Product> getContents() throws Exception;
	
	public Product getContent(int id) throws Exception;
	
	public List<BoughtProduct> getAccount( int userId) throws Exception;
	
	public BoughtProduct getBoughtProduct( int userId, int contentId) throws Exception;
	
	@Transactional
	public int addProductAndGetLastId( Product p) throws Exception;
	
	public ShowProduct getShowProduct(int id,HttpSession session ) throws Exception;
	
	public Result buyProduct(HttpSession session, int ProductId,Result result) throws Exception;
	
	public Product getSelledProductId(int productId) throws Exception;
	
	public void editProduct( Product product) throws Exception;
	
	public void deleteProduct(int id) throws Exception;

}
